/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package kom.level;

import java.awt.Graphics2D;
import kom.Bitmaps;
import kom.InputHandler;
import kom.Kom;
import kom.Map;
import kom.Player;

/**
 *
 * @author Nathan
 */
public class Level {
    private Map map;
    private Player player;
    private InputHandler input;
    
    private int xOffset = 0;
    private int yOffset = 0;
    
    public Level(int mapsize) {
        map = new Map(mapsize);
        player = new Player();
        map.addPlayer(player);
    }
    
    public void tick() {
        map.tick();
        input.checkPlayer(player, map);
    }
    
    public void render(Graphics2D g, Bitmaps bitmaps) {
        xOffset = (int) player.getX() - (Kom.width / 2);
        yOffset = (int) player.getY() - (Kom.height / 2);
        map.render(g, bitmaps, xOffset, yOffset);
    }

    public InputHandler getInput() {
        return input;
    }

    public void setInput(InputHandler input) {
        this.input = input;
    }

    public Map getMap() {
        return map;
    }

    public void setMap(Map map) {
        this.map = map;
    }

    public Player getPlayer() {
        return player;
    }

    public void setPlayer(Player player) {
        this.player = player;
    }

    public int getxOffset() {
        return xOffset;
    }

    public void setxOffset(int xOffset) {
        this.xOffset = xOffset;
    }

    public int getyOffset() {
        return yOffset;
    }

    public void setyOffset(int yOffset) {
        this.yOffset = yOffset;
    }
    
    
}
